﻿@using KMF.Utility
@using KMF.WebUI.CustomHelpers
@using KMF.WebUI.Models
@model List<KMF.Common.ProductRateByCateTopListPagingDto>

<div class="product_list_cate">

    <div class="product_cate_title">
        <div class="cate_title">@ViewBag.CateName<span>(@ViewBag.TotalRecod sản phẩm)</span></div>
        <input type="hidden" class="hidRecordByPage" value="@ViewBag.RecordByPage" />
        <ul class="litsCo ul">
            <li>
                <a href="javascript:void(0);" rel="nofollow" idata="OEJHY">Hàng mới</a>
            </li>
            <li>
                <a href="javascript:void(0);" rel="nofollow" idata="ACCEH">Hàng sale</a>
            </li>
            <li>
                <a href="javascript:void(0);" rel="nofollow" idata="GJUYR" class="active_type">Tất cả sản phẩm</a>
            </li>
        </ul>
    </div>
    @{     
        <div class="product_tab">
            @if (Model.Any())
            {
                <ul>

                    @foreach (var item in Model)
                    {
                        using (Html.BeginForm("DiscountProduct", "Home", FormMethod.Post))
                        {
                            var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                        <li>
                            @Html.Hidden("productId", item.Id)
                            @Html.Hidden("productIdRoot", item.Id)
                            @Html.Hidden("productImagePath", item.ImagePath)
                            @Html.Hidden("rootPriceProduct", item.Price)
                            @Html.Hidden("promotionPrice", item.PromotionPrice)
                            <input type="hidden" name="productName" id="productName" value="@item.Name" />
                            <input type="hidden" value="1" name="productQuantity" id="productQuantity" />
                            @Html.Hidden("productStatus", item.ProductStatus)
                            @Html.Hidden("productColor")
                            @Html.Hidden("productColorCode")
                            @Html.Hidden("productSizeId")
                            @Html.Hidden("productSizeName")
                            @Html.Hidden("productSizePrice")
                            @Html.Hidden("promotionPercent", item.DiscountPercentage)
                            @Html.Hidden("decreasePrice", item.DiscountAmount)
                            @Html.Hidden("providerName", item.ProviderName)
                            @Html.Hidden("categoryId", item.CategoryId)

                            <div class="home_image">
                                <a href="@pDetailLink">
                                    <img src="@item.ImagePath.ImagePathThumb(159, 243)" width="159" height="243" alt="@item.Name" class="lzLoading"/></a>
                                @if (item.PromotionPrice > 0)
                                {
                                    <span class="product_discount">-@item.DiscountPercentage.ToString("#.#")%</span>
                                }

                            </div>
                            <a class="product_title" href="@pDetailLink">@item.Name</a>
                            <span class="home_price">@item.Price.ToString("##,###,###") đ</span>
                            <input type="submit" class="home_cart" /><a href="@pDetailLink" class="home_readmore"></a>
                        </li>
                        }
                    }

                </ul>
            }
            else
            {
                <div>Không có sản phẩm nào</div>
            }
        </div>
    }
    <input type="hidden" value="@ViewBag.Category/@ViewBag.CateFill" id="hidFillData" />
</div>
